home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2204 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: taco.cc.ncsu.edu!news
  2. From: Alex David Groce <adgroce>
  3. Newsgroups: comp.lang.c
  4. Subject: I/O Question
  5. Date: 19 Jan 1996 21:16:38 GMT
  6. Organization: North Carolina State University
  7. Message-ID: <4dp1nm$mu6@taco.cc.ncsu.edu>
  8. NNTP-Posting-Host: c00993-224wi.eos.ncsu.edu
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.12 (X11; I; SunOS 5.4 sun4m)
  13. X-URL: news:comp.lang.c/21953-22052
  14.  
  15. I'm relatively inexperienced in C, was started with C++ here at NC State.
  16. Anyway, working on a project where speed really matters, I'm reading
  17. from a file containing 100001 integers in text format.  I was originally
  18. using C++'s iostreams, but discovered the using stdio.h speeded things up
  19. by an incredible factor.  I guess the C++ routines are so general that
  20. they're slllooooooooww as molasses.  Anyway, I'm using scanf now, as in
  21.  
  22. while (scanf("%i", &list[count++]) != EOF); // Read elements.
  23. count--; // Avoid good old OBOB, the Off-By-One-Bug.
  24.  
  25. Would it be worth my time to learn buffered I/O techniques, read or
  26. getchar or such, to input this data?  Every little bit of time
  27. counts...  Or is there a good example somewhere of a fast way to do
  28. this?
  29.  
  30. -- 
  31. "And ye shall know the truth, and the truth shall set you free." - John 8:32
  32. --
  33. Alex David Groce (adgroce@eos.ncsu.edu)
  34. Sophomore (Computer Science/Multi-Disciplinary Studies/Applied Mathematics)
  35. 1995-96 DPMA Secretary
  36. 1005B Sullivan Hall (512-5172)
  37. http://www4.ncsu.edu/eos/users/a/adgroce/WWW/index.html
  38.  
  39.